Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

1.17 Linux Directory Structure

In the Linux Filesystem Hierarchy Standard (FHS), the directory structure is not a random collection of directories but follows a strict logic. For embedded systems such as the NXP i.MX6 Solo, understanding these directories helps you precisely locate kernel images, configuration files, and driver nodes.

Linux does not partition drives into distinct drive letters (such as C: or D:); instead, all devices are mounted at specific locations underneath the single root directory /. The following is a quick reference guide to the core directories.

Core Boot and System Files

  • /boot: Contains the essential files required for booting the system. The kernel image (zImage), Device Tree blobs (DTBs), initramfs, and bootloader files are typically stored here.

  • /bin: Contains basic, essential system binaries and commands required for system booting and operation (such as ls, cp, sh), which are accessible to all users. Typical commands like ls, cp, mv, cat, and are located here.

  • /sbin: Contains system administration binaries (System Binaries) such as ifconfig, fdisk, reboot, and addgrp. These tools are designated for hardware management and system maintenance routines.

  • /lib: Contains essential dynamic shared libraries (.so files) and kernel modules (modules) needed by the binaries in /bin and /sbin. Without this directory, the basic commands in /bin cannot execute.

Hardware and Configuration

  • /dev: The location of device files. In Linux, everything is a file. Serial ports (tty), SD cards (mmcblk0), and USB devices are all accessed via nodes in this directory. It contains numerous subdirectories corresponding to different devices, such as tty, sda, and null. These files are dynamically populated by the kernel and udev.

  • /etc: The system configuration directory. It houses network configurations, user passwords, startup scripts (such as rc.local), and kernel parameters (sysctl.conf) applied after Linux boots.

    • /etc/passwd: Stores user account details and credentials.

    • /etc/fstab: Defines the file systems to be mounted automatically at boot time, along with their respective mount options.

    • /etc/hostname: Stores the system network host name.

    • /etc/systemd/: Contains local systemd configuration and service unit files; it is the core configuration directory for system service management.

Virtual File Systems /sys and /proc

  • /proc: Reflects process and kernel runtime states (such as CPU metrics), allowing users to monitor active process state data by reading files within this path. It is a virtual file system (procfs) in Linux that consumes zero disk space, as all contents are generated dynamically in memory by the kernel. Each active process maps to a specific subdirectory named after its unique Process ID (PID).

  • /sys: Exports kernel objects and hardware topologies. Manipulating GPIO pins or adjusting LED brightness is commonly handled under this path. System administrators utilize files here for resource configuration and device management. The standard top-level subdirectories include:

    • /sys/block

    • /sys/bus

    • /sys/class

    • /sys/devices

    • /sys/firmware

    • /sys/fs

    • /sys/kernel

    • /sys/module

    • /sys/power

The /sys/devices subdirectory acts as the core repository for the live Device Tree representation; the complete hierarchical structural arrangement of all registered devices inside the running kernel resides here. It reflects the true physical hardware topology and serves as the primary root of sysfs (e.g., /sys/devices/pci0000:00/ and /sys/devices/system/cpu/). All entries under /sys/class and /sys/bus ultimately resolve back to files inside this directory via symbolic links. It can be understood as the definitive physical device topology tree.

The /sys/class subdirectory provides a logical view of devices grouped by function class. These entries are typically symbolic links pointing directly to the actual device nodes under /sys/devices, making this the most frequently accessed interface from user space. It primarily includes elements such as:

  • /sys/class/net/

  • /sys/class/block/

  • /sys/class/leds/

  • /sys/class/gpio/

For example:

  • /sys/class/net/eth0 corresponds to the primary Ethernet interface.

  • /sys/class/block/sda corresponds to the first storage disk.

The /sys/block subdirectory holds the nodes corresponding to block devices. For instance, /sys/block/sda/ maps to a disk drive, while the /sys/block/mmcblk0/ subdirectory represents the primary MultiMediaCard (MMC) storage device. These entries encompass files such as size, queue/, and stat. They are commonly utilized for storage performance profiling, I/O tuning, and flash storage management in embedded deployments.

The /sys/bus path houses devices organized hierarchically by their physical or virtual bus types, such as /sys/bus/pci/, /sys/bus/usb/, /sys/bus/i2c/, and /sys/bus/platform/. These match PCI bus devices, USB devices, I2C peripherals, and integrated platform devices, respectively. Each individual bus contains a device description subdirectory (devices/) and a driver tracking subdirectory (drivers/) (e.g., /sys/bus/pci/devices/ and /sys/bus/pci/drivers/). This layout represents the definitive boundary layer where the kernel executes device-to-driver matching.

The /sys/module subdirectory exposes active kernel modules, such as /sys/module/ext4/ and /sys/module/nvme/. The content includes diagnostic files and paths like initsize, parameters/, refcnt, and sections/, which allow users to inspect live module configurations or dynamically tweak exported module runtime variables.

The /sys/kernel interface handles core kernel subsystem parameters, hosting critical entries like /sys/kernel/debug, /sys/kernel/mm, and /sys/kernel/tracing. Here, /sys/kernel/debug exposes the debugfs boundary layer (requiring an explicit, separate mount operation), and /sys/kernel/tracing exposes the active ftrace engine interface.

The /sys/fs path maps to the file system subsystem interface layer (e.g., /sys/fs/cgroup, /sys/fs/ext4, and /sys/fs/bpf). It tracks and exposes operational state statistics specific to file systems active within standard cgroups.

The /sys/firmware path contains low-level firmware-related configurations and exports, including /sys/firmware/efi and /sys/firmware/devicetree. ARM-based embedded systems heavily leverage the /sys/firmware/devicetree/base directory directory to export the flattened device tree abstraction layer to user space.

The /sys/power interface handles system-wide power management parameters, exposing files like /sys/power/state and /sys/power/wakeup_count. For instance, executing:

echo mem > /sys/power/state

forces the hardware into a suspend-to-RAM state.

The /sys/devices/system path aggregates infrastructure-critical system-level hardware devices, including /sys/devices/system/cpu/, /sys/devices/system/memory/, and /sys/devices/system/node/. For instance, executing:

echo 0 > /sys/devices/system/cpu/cpu1/online

takes CPU1 offline.

User and Application Space

  • /usr: Houses user-space applications and secondary utilities, conceptually mapping to C:\Program Files in Windows architectures.

  • /usr/bin: Contains non-essential system-wide user binary commands.

  • /usr/lib: Contains shared libraries consumed by binaries located under /usr/bin and /usr/sbin.

  • /var: Stores highly dynamic variable data, such as system event logs (/var/log) or package manager cache indexes.

  • /home: Serves as the primary root hosting individual unprivileged user home directories.

  • /root: The dedicated private home directory of the system superuser (root). Note that it is isolated outside the /home directory tree.

Other Key Directories

  • /tmp: Temporary storage directory. Files housed within this path are generally swept and purged during system boot sequences.

  • /mnt: General purpose mount point used to manually mount temporary external file system volumes.

  • /media: Automatically managed mount points for plug-and-play removable storage devices (such as USB thumb drives).

  • /opt: Add-on repository designated for hosting third-party monolithic software application packages.

  • /run: Holds ephemeral runtime data tracking active system operations since boot, such as process ID files (.pid) and active domain sockets. This path exists entirely in volatile memory and is wiped during reboots.

  • /lost+found: A repository used by file system check utilities (like fsck) to deposit orphaned file fragments recovered after structural file system corruption.

Copyright © 2026 Guangzhou eSmart Information Technology Co., Ltd. All Rights Reserved.
All content in this book is copyrighted by the author. For personal learning and exchange only. Commercial use without authorization is strictly prohibited. Email:

✉ 3348194517@qq.com | hai616878@gmail.com